from django.contrib import admin
from radius.models import *
# Register your models here.

# class myadmin(admin.ModelAdmin):
#     list_display = ('username','attribute','op','value')
#     list_per_page=10
#     list_max_show_all = 200
#     search_fields = ('username','value')
#
# class myadmin1(admin.ModelAdmin):
#     list_display = ('username','groupname','priority')
#     list_per_page=10
#     list_max_show_all = 200
#     search_fields = ('username','priority')

class Macaddress_model(admin.ModelAdmin):

    list_display = ('macaddress','shopid')
    # 点击这个字段进入编辑界面
    list_display_links = ('macaddress',)
    list_per_page=10
    list_max_show_all = 200
    search_fields = ('macaddress',)
    # search_fields = ('macaddress','shopid')
    # 按照字段排序
    ordering = ('-macaddress',)


class Shop_model(admin.ModelAdmin):
    list_display = ('shopid','shopname','cityid')
    # 点击这个字段进入编辑界面
    list_display_links = ('shopid',)
    list_per_page=10
    list_max_show_all = 200
    search_fields = ('shopid',)
    # search_fields = ('shopid','shopname','cityid')

class City_model(admin.ModelAdmin):
    list_display = ('cityid','cityname')
    # 点击这个字段进入编辑界面
    list_display_links = ('cityid',)
    list_per_page=10
    list_max_show_all = 200
    search_fields = ('cityname',)

    # search_fields = ('cityid','cityname')

#class City_shop_mac_model(admin.ModelAdmin):
#    list_display = ('cityname','shopname','macaddress')
#    list_per_page=40
#    list_max_show_all = 200
#    search_fields = ('cityname','shopname','macaddress')


# admin.site.register(Radcheck,myadmin)
# admin.site.register(Radusergroup,myadmin1)
######################## 注册到admin 

admin.site.register(Macaddress,Macaddress_model)
admin.site.register(Shop,Shop_model)
admin.site.register(City,City_model)
#admin.site.register(CityShopMac,City_shop_mac_model)
# 修改站点名
admin.site.site_header = 'radius管理后台'
admin.site.site_title = 'radius管理后台'